/*
 * @Author: dfh
 * @Date: 2024-10-16 08:26:35
 * @LastEditors: dfh
 * @Modified By: dfh
 * @describe: 
 */
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_echarts/flutter_echarts.dart';

class UserWidget extends StatelessWidget {
  final List<String> dataX;

  final List<String> dataY;
  final List<String> data2Y;

  const UserWidget(
      {super.key,
      required this.dataX,
      required this.dataY,
      required this.data2Y});

  @override
  Widget build(BuildContext context) {
    print('x轴:${dataX.toString()}');
    print('总用户:${dataY.toString()}');
    print('新用户:${data2Y.toString()}');
    return SizedBox(
       width: 300,
                height: 250,
      child: Echarts(
        option: '''
     {
      title: {
        text: 'Stacked Line'
      },
      tooltip: {
        trigger: 'axis'
      },
      legend: {
        data: ['Email', 'Union Ads']
      },
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: 'Email',
          type: 'line',
          stack: 'Total',
          data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
          name: 'Union Ads',
          type: 'line',
          stack: 'Total',
          data: [220, 182, 191, 234, 290, 330, 310]
        }
      ]
    }
  ''',
      ),
      
    );
  }
}
